import { Router } from 'express';
import { TrafficController } from '../controllers/traffic.controller';
import upload from '../middlewares/upload';

const router = Router();
const trafficController = new TrafficController();

// 获取流量数据列表
router.get('/', trafficController.getTrafficList);

// 获取流量数据汇总
router.get('/summary', trafficController.getTrafficSummary);

// 获取流量来源分布
router.get('/source-distribution', trafficController.getSourceDistribution);

// 获取转化率趋势
router.get('/conversion-trend', trafficController.getConversionTrend);

// 导出数据
router.get('/export', trafficController.exportData);

// 导入Excel数据
router.post('/import', upload.single('file'), trafficController.importExcel);

// 创建流量数据
router.post('/', trafficController.createTrafficData);

// 批量更新流量数据
router.put('/batch', trafficController.batchUpdateTrafficData);

// 更新流量数据
router.put('/:id', trafficController.updateTrafficData);

// 批量删除流量数据
router.delete('/batch', trafficController.batchDeleteTrafficData);

// 删除流量数据
router.delete('/:id', trafficController.deleteTrafficData);

export default router; 